package com.kaili.db.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.kaili.pojo.entity.HsEwbsSignDetail;
import com.kaili.db.mapper.HsEwbsSignDetailMapper;
import com.kaili.db.service.IHsEwbsSignDetailService;
import com.kaili.pojo.vo.SignQueryExportVO;
import com.kaili.pojo.vo.SignQueryVO;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cgm
 * @since 2018-05-08
 */
@Service
public class HsEwbsSignDetailServiceImpl extends ServiceImpl<HsEwbsSignDetailMapper, HsEwbsSignDetail> implements IHsEwbsSignDetailService {
    @Override
    public Page<SignQueryVO> getSignList(Page<SignQueryVO> page, Map search) {
        return page.setRecords(baseMapper.getSignList(page,search));
    }

    @Override
    public boolean insertBatch(List<HsEwbsSignDetail> list){
        baseMapper.insertBatch(list);
        return true;
    }

    @Override
    public List<SignQueryExportVO> getExportSignList(Map search) {
        return baseMapper.getExportSignList(search);
    }

    @Override
    public boolean hasSigned(HsEwbsSignDetail ewb) {
        Map search = new HashMap();
        search.put("ewb_no", ewb.getEwbNo());
        search.put("site_id", ewb.getSiteId());
        List<HsEwbsSignDetail> lst = baseMapper.selectByMap(search);
        if (lst != null && lst.size() > 0)
            return true;
        else
            return false;
    }


}
